﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ClientUI
{
    public partial class MessageWnd : Form
    {

        int SH = Screen.PrimaryScreen.Bounds.Height;
        int SW = Screen.PrimaryScreen.Bounds.Width;
        public MessageWnd()
        {
            InitializeComponent();
        }

        private delegate void showdel(string Title, string Msg);

        public void ShowMsg(string Title, string Msg)
        {
            SH = (int)System.Windows.SystemParameters.WorkArea.Height;
            SW = (int)System.Windows.SystemParameters.WorkArea.Width;
            this.lHead.Text = Title;
            this.txtMsg.Text = Msg;
            this.Top = SH ;
            this.Left = SW - this.Width;
            this.TopMost = true;
            this.BringToFront();
            timer1.Start();
            this.ShowDialog();
        }


        private void lClose_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            SH = (int)System.Windows.SystemParameters.WorkArea.Height;
            SW = (int)System.Windows.SystemParameters.WorkArea.Width;
            if(this.Top>SH-this.Height)
            {
                this.Top -= 10;
            }
            else
            {
                timer1.Stop();
            }
        }

    }
}
